package org.john.javalib;

import java.sql.Timestamp;

/**
 * Created by adsame on 17-2-15.
 */
public class MathTest {
    public static  void main(String args[]) {
        double base = 1.4d;
        double a = Math.floor(base);
        double b = Math.ceil(base);
        double c = Math.round(base);
        long l1 = 3;
        long l2  = 10;
        long d = -1;
        System.out.println(a + "," + b + "," + c + ", d:" + d);
        long now = System.currentTimeMillis();
        for (int i = 0; i < 10000000; ++i) {
            d = (long)Math.ceil((double)l1/l2);
        }
        long diff = System.currentTimeMillis() - now;
        System.out.println("d:" + d);
        System.out.println("convert:" + diff);
        now = System.currentTimeMillis();
        for (int i = 0; i < 10000000; ++i) {
            d = (long)Math.ceil(l1 * 1.0d/l2);
        }
        diff = System.currentTimeMillis() - now;
        System.out.println("d:" + d);
        System.out.println("calculate:" + diff);
        System.out.println(a + "," + b + "," + c + ", d:" + d);
        now = System.currentTimeMillis();
        Timestamp ts = new Timestamp(now);
        System.out.println(ts);
        System.out.println(ts.toString());
    }
}
